//
//  CommentCell.m
//  myhuibao
//
//  Created by li jun on 13-2-28.
//  Copyright (c) 2013年 myhuibao. All rights reserved.
//

#import "CommentCell.h"

@implementation CommentCell
@synthesize lbNickName;
@synthesize lbScore;
@synthesize lbScore1;
@synthesize lbScore2;
@synthesize lbScore3;
@synthesize lbContent;
@synthesize lbTime;
@synthesize score;

-(void)setScore:(NSNumber *)s {
    //    if (![s isEqualToNumber:score]) {
    score = [s copy];
    int z = [score intValue];
    int empty=0;
    if(z==0){
        for(int i=0;i<5;i++){
            UIImageView *im = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ic_star_empty.png"]];
            im.frame = CGRectMake(i*12+5, 0, 12, 12);
            //            im.contentMode = UIViewContentModeScaleAspectFit;
            [self.lbScore addSubview:im];
        }
    }else{
        for(int i=0;i<z;i++){
            UIImageView *im = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ic_star.png"]];
            im.frame = CGRectMake(i*12+5, 0, 12, 12);
            [self.lbScore addSubview:im];
            empty++;
        }
        if(z< [score floatValue]){
            UIImageView *im = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ic_star_half.png"]];
            im.frame = CGRectMake((z)*12+5, 0, 12, 12);
            [self.lbScore addSubview:im];
            empty++;
            z++;
        }
        for(int i=0;i<5-empty;i++){
            UIImageView *im = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ic_star_empty.png"]];
            im.frame = CGRectMake(z++*12+5, 0, 12, 12);
            //            im.contentMode = UIViewContentModeScaleAspectFit;
            [self.lbScore addSubview:im];
        }
    }
    //        self.scoreLable.text = score;
    //    }
}

@end
